package com.zl.controller;

import com.alibaba.fastjson.JSON;
import com.zl.pojo.TSJ;
import com.zl.util.RedisUtil;
import com.zl.vo.SysResult;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import redis.clients.jedis.Jedis;
@CrossOrigin
@RestController
@RequestMapping("/zl")
public class TSJController1 {
    @GetMapping("/selectvalue1")
    public Object selectValue(String key) {
        Jedis jedis = null;//定义jedis实例对象
        try {
            jedis = RedisUtil.getJedis();//获取jedis实例对象
            String value = jedis.get(key);//获取对应value值
            TSJ tsj = JSON.parseObject(value, TSJ.class);//获取提升机数据对象
            return SysResult.success(tsj);//将数据获取状态和数据返回给前端页面
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            RedisUtil.close(jedis);//关闭jedis资源

        }

    }
}
